package br.inf.solutions.apresentacoes.ssp.model.bulletin;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;

import br.com.vexillum.model.CommonEntityActivated;
import br.com.vexillum.model.annotations.SearchField;
import br.inf.solutions.apresentacoes.ssp.model.Person;
import br.inf.solutions.apresentacoes.ssp.model.interfaces.IExistsPerson;

@SuppressWarnings("serial")
@Entity
@Table(name="bulletin_await_itens")
public class BulletinAwaitItens extends CommonEntityActivated implements IExistsPerson {

	public BulletinAwaitItens() {}
	
	public BulletinAwaitItens(BulletinItem item, BulletinTopics topic) {
		this.item = item;
		this.topic = topic;
	}
	
	@ManyToOne(fetch = FetchType.LAZY)
	@Cascade(value={CascadeType.MERGE, CascadeType.PERSIST, CascadeType.SAVE_UPDATE})
	@JoinColumn(name = "id_item", nullable = false, updatable = false, unique = false)
	private BulletinItem item;
	
	@SearchField
	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "id_topic", nullable = false, updatable = false, unique = false)
	private BulletinTopics topic;

	public BulletinItem getItem() {
		return item;
	}

	public void setItem(BulletinItem item) {
		this.item = item;
	}

	public BulletinTopics getTopic() {
		return topic;
	}

	public void setTopic(BulletinTopics topic) {
		this.topic = topic;
	}

	@Override
	public Person getPerson() {
		return null;
	}

	@Override
	public void setPerson(Person person) {}

}
